package com.tiantianfresh.admin.service.Impl;

import com.tiantianfresh.model.dao.UserMapper;
import com.tiantianfresh.model.pojo.User;
import com.tiantianfresh.admin.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author FANGAO
 * @date 2021/11/9 - 上午 11:37
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public User queryUserLogin(User user) {
        return userMapper.queryUserLogin(user);
    }

    @Override
    public int userTotalCount(Map<String,Object> map) {
        return userMapper.userTotalCount(map);
    }

    @Override
    public List<User> getListUser(Map<String,Object> map) {
        return userMapper.getListUser(map);
    }

    @Override
    public boolean userInsert(User user) {
        if(userMapper.userInsert(user)>0)return true;
        return false;
    }

    @Override
    public User queryByid(Integer id) {
        return userMapper.queryByid(id);
    }

    @Override
    public boolean userUpdate(User user) {
        if (userMapper.userUpdate(user)>0) return true;
        return false;
    }

    @Override
    public boolean userDelete(Integer id) {
        if (userMapper.userDelete(id)>0) return true;
        return false;
    }

    @Override
    public boolean deleteUsers(Map<String,Object> map) {
        if (userMapper.deleteUsers(map)>0) return true;
        return false;
    }

    @Override
    public boolean addUserAndRole(Map<String, Object> map) {
        if (userMapper.addUserAndRole(map)>0) return true;
        return false;
    }

    @Override
    public boolean deleteUserAndRole(Map<String, Object> map) {
        if (userMapper.deleteUserAndRole(map)>0) return true;
        return false;
    }

    @Override
    public List<Integer> getRoleids(Integer id) {
        return userMapper.getRoleids(id);
    }

    @Override
    public boolean updateuser(User user) {
        if(userMapper.updateuser(user)>0)return true;
        return false;
    }
}
